﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace LayeredArchitectureSample.DomainModel.Tests
{
    [TestClass]
    public class RouteTests
    {
        [TestMethod]
        public void MakeSureExactlySameWaypointSetsMatch()
        {
            var route = new Route(1, new[] { new Location(1, "NYC"), new Location(2, "msk"), new Location(3, "spb")});

            Assert.IsTrue(route.DoWaypointsMatch(new[] { new Location(1, "NYC"), new Location(2, "msk"), new Location(3, "spb")}));
        }

        [TestMethod]
        public void MakeSureWaypointSetsWithSameElementsButInDifferentOrderDoNotMatch()
        {
            var route = new Route(1, new[] { new Location(1, "NYC"), new Location(2, "msk"), new Location(3, "spb") });

            Assert.IsFalse(route.DoWaypointsMatch(new[] { new Location(1, "NYC"), new Location(3, "spb"), new Location(2, "msk") }));
        }

        [TestMethod]
        public void MakeSureWaypointSetsOneBeingSubsetOfAnotherDoNotMatch()
        {
            var route = new Route(1, new[] { new Location(1, "NYC"), new Location(2, "msk") });

            Assert.IsFalse(route.DoWaypointsMatch(new[] { new Location(1, "NYC"), new Location(2, "msk"), new Location(3, "spb") }));
            Assert.IsFalse(route.DoWaypointsMatch(new[] { new Location(1, "NYC") }));
        }

        [TestMethod]
        public void MakeSureWaypointSetsWithDifferentElementsDoNotMatch()
        {
            var route = new Route(1, new[] { new Location(1, "NYC"), new Location(2, "msk") });

            Assert.IsFalse(route.DoWaypointsMatch(new[] { new Location(11, "NYC"), new Location(12, "msk") }));
        }
    }
}